package lumis.portal.page.serialization;

import java.util.EnumSet;

import lumis.portal.PortalException;
import lumis.portal.page.PageConfig;
import lumis.portal.serialization.BaseSerializationContext;
import lumis.portal.serialization.SerializationMessageConfigNode;
import lumis.portal.serialization.DeserializationContext;
import lumis.portal.serialization.SerializationContext;
import lumis.portal.serialization.SerializationMessageConfigNode.RecursionStopPoints;

/**
 * Manager Interface for Page serialization
 *
 * @version $Revision: 6880 $ $Date: 2007-05-16 16:41:21 -0300 (Wed, 16 May 2007) $
 * @since 4.0.7
 */
public interface IPageSerializationManager
{
	// DESERIALIZATION
	
	/**
	 * Deserialize a page.
	 * @param deserializationContext
	 * @param pageSerializableConfig
	 * @throws PortalException
	 */
	public void deserialize(DeserializationContext deserializationContext, PageSerializableConfig pageSerializableConfig) throws PortalException;

	// SERIALIZATION
	
	/**
	 * Serialize a page.
	 * @param serializationContext
	 * @param pageId
	 * @param deepSerialization
	 * @return
	 * @throws PortalException
	 */
	public PageSerializableConfig serialize(SerializationContext serializationContext, String pageId, boolean deepSerialization) throws PortalException;

	// GENERAL
	
	/**
	 * Set up a serialization context, defining settings such as class aliases, field aliases, transient fields, omitted collections etc.
	 * @param serializationContext
	 */
	public void setupSerializationContext(BaseSerializationContext serializationContext);
	
	/**
	 * Get a {@link SerializationMessageConfigNode} object containing fully recursive information about a page.
	 * @param baseSerializationContext
	 * @param pageConfig
	 * @return
	 * @throws PortalException
	 */
	public SerializationMessageConfigNode getSerializationMessageConfigNode(BaseSerializationContext baseSerializationContext, PageConfig pageConfig) throws PortalException;

	/**
	 * Get a {@link SerializationMessageConfigNode} object containing partially recursive information about a page.
	 * @param baseSerializationContext
	 * @param pageConfig
	 * @param recursionStopPoints
	 * @return
	 * @throws PortalException
	 */
	public SerializationMessageConfigNode getSerializationMessageConfigNode(BaseSerializationContext baseSerializationContext, PageConfig pageConfig, EnumSet<RecursionStopPoints> recursionStopPoints) throws PortalException;
}
